package com.web.music.portal.mvc;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.web.music.interfaces.AlbumService;
import com.web.music.interfaces.SecurityController;
import com.web.music.model.Album;

public class ListAllAlbumController implements Controller {

	private AlbumService albumService;
	private SecurityController securityController;
	
	public AlbumService getAlbumService() {
		return albumService;
	}

	public void setAlbumService(AlbumService albumService) {
		this.albumService = albumService;
	}

	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) 
	throws Exception 
	{
		List<Album> albums = albumService.findAll();
		securityController.updateSecurityStatus(request, albums);
		return new ModelAndView("album_listall", "list", albums);
	}
	public SecurityController getSecurityController() {
		return securityController;
	}

	public void setSecurityController(
			SecurityController securityController) {
		this.securityController = securityController;
	}	
}